/**
 * OrderService.java
 * 
 * Copyright@2015 OVT Inc. All rights reserved. 
 * 
 * 2015年12月21日
 */
package com.ovt.order.service;

import java.util.List;

import com.ovt.order.dao.contant.OrderState;
import com.ovt.order.dao.vo.Order;
import com.ovt.order.dao.vo.OrderItem;
import com.ovt.order.dao.vo.RefundRequest;
import com.ovt.order.dao.vo.TransferRequest;
import com.ovt.order.service.exception.ServiceException;

/**
 * OrderService
 * 
 * @Author brad.zhou
 * @Version 1.0
 * @See
 * @Since [OVT Cloud Platform]/[API] 1.0
 */
public interface OrderService
{
    /**
     * Register new order.
     * 
     * @param userId
     * @param totalFee
     * @param productList
     * @return Order
     * @throws ServiceException
     */
    public Order createOrder(long userId, float totalFee, String remark,
            List<OrderItem> productList) throws ServiceException;

    /**
     * Get order list by userId.
     * 
     * @param userId
     * @return List<Order>
     * @throws ServiceException
     */
    public List<Order> queryOrderList(long userId) throws ServiceException;

    /**
     * Get order detail information by orderNo.
     * 
     * @param orderNo
     * @return Order
     * @throws ServiceException
     */
    public Order queryOrderInfo(String orderNo) throws ServiceException;

    /**
     * Get order detail information by userId and orderNo.
     * 
     * @param userId
     * @param orderNo
     * @return Order
     * @throws ServiceException
     */
    public Order queryOrderInfo(long userId, String orderNo)
            throws ServiceException;

    /**
     * Cancel a exist order.
     * 
     * @param userId
     * @param orderNo
     * @return Order
     * @throws ServiceException
     */
    public Order cancelOrder(long userId, String orderNo)
            throws ServiceException;

    /**
     * Delete a exist order.
     * 
     * @param userId
     * @param orderNo
     * @return Order
     * @throws ServiceException
     */
    public Order deleteOrder(long userId, String orderNo)
            throws ServiceException;

    /**
     * Apply for refund by users themselves.
     * 
     * @param userId
     * @param orderId
     * @param refundReasonId
     * @param refundFee
     * @param refundDesc
     * @return String
     * @throws ServiceException
     */
    public String applyForRefund(long userId, String orderNo,
            int refundReasonId, float refundFee, String refundDesc)
            throws ServiceException;

    /**
     * Get RefundRequest's list by auditor.
     * 
     * @return List<RefundRequest>
     * @throws ServiceException
     */
    public List<RefundRequest> queryRefundRequestList() throws ServiceException;

    /**
     * Get TransferRequest's list by auditor.
     * 
     * @return List<TransferRequest>
     * @throws ServiceException
     */
    public List<TransferRequest> queryTransferRequestList()
            throws ServiceException;

    /**
     * Get RefundRequest list by requestId list.
     * 
     * @param List<Long> requestIdList
     * @return List<RefundRequest>
     * @throws ServiceException
     */
    public List<RefundRequest> queryRefundRequestList(List<Long> requestIdList)
            throws ServiceException;

    /**
     * Set order state by orderNo and state.
     * 
     * @param orderNo
     * @param state
     * @return OrderState
     * @throws ServiceException
     */
    public OrderState setOrderState(String orderNo, OrderState state)
            throws ServiceException;

    /**
     * Set refundRequestList state by requestId list and state.
     * 
     * @param requestListId
     * @param state
     * @return OrderState
     * @throws ServiceException
     */
    public OrderState setRefundRequestListState(List<Long> requestIdList,
            OrderState state) throws ServiceException;
    
    /**
     * Set refundRequestList by requestId list, state and auditorId.
     * 
     * @param requestListId
     * @param state
     * @param auditorId
     * @return OrderState
     * @throws ServiceException
     */
    public OrderState setRefundRequestList(List<Long> requestIdList,
            OrderState state, long auditorId) throws ServiceException;
    
    /**
     * Set refundRequestList by requestId list, state, feedback and auditorId.
     * 
     * @param requestListId
     * @param state
     * @param auditorId
     * @param feedback
     * @return OrderState
     * @throws ServiceException
     */
    public OrderState setRefundRequestList(List<Long> requestIdList,
            OrderState state, long auditorId, List<String> feedback) throws ServiceException;

    /**
     * Put auditorId that process the refund request action into DB.
     * @param requestListId
     * @param processerId
     * @throws ServiceException
     */
    public void putAuditorId(List<Long> requestListId, Long auditorId)
            throws ServiceException;
}
